package com.hmall.search.listen;


import com.hmall.client.MyFeignClient;
import com.hmall.search.common.dto.Item;
import com.hmall.search.constants.MqConstants;
import com.hmall.search.service.SearchService;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class HotelListener {
    @Autowired
    MyFeignClient feignClient;


    @Autowired
    SearchService searchService;

    @RabbitListener(queues = MqConstants.HOTEL_INSERT_QUEUE)
    public void listenInsertMsg(Long id) {
        searchService.insert(id);
        log.info("接收到上架消息通知  id{}",id);
    }

    @RabbitListener(queues = MqConstants.HOTEL_DELETE_QUEUE)
    public void listenDeleteMsg(Long id) {
        searchService.delete(id);
        log.info("接收到下架消息通知  id{}",id);
    }
}
